<template>
  <div class="temp">
    支付金额:<span style="font-size:20px;font-weight:bold;">{{acount}}</span><br>
    <el-button type="success" @click='getorder'>支付</el-button> 
    
  </div>
</template>
<script>
    export default {
        data() {
            return {
                orderid: this.$route.params.ouderID, //订单ID
                acount: this.$route.params.acount, //总价格
            }
        },
        methods: {
            // 点击支付的按钮事件
            getorder() {
                var url = '/site/validate/order/pay/' + this.orderid;
                this.$http.get(url).then(res => {
                    if (res.data.status == 1) {
                        return this.$message.error(res.data.message);
                    }
                    // 支付成功  会修改订单的支付状态（status）为2（已支付）
                    this.$message.success({
                        message: '支付成功',
                        duration: 1000,
                        onClose: () => {
                            this.$router.push({
                                name: 'paysuccess'
                            })
                        }
                    })
                })
            }
        }
    }
</script>
<style></style>